package Data::Conveyor::Storage::DBI;

# $Id: DBI.pm 13653 2007-10-22 09:11:20Z gr $

use strict;
use warnings;
use Error::Hierarchy::Internal::DBI::STH;
use Error ':try';


our $VERSION = '0.02';


use base 'Data::Conveyor::Storage';


__PACKAGE__->mk_scalar_accessors(qw(idcache));


use constant DEFAULTS => (
    idcache => {},
);


# Subclasses could override this to rethrow certain ::DBI::STH exceptions as
# something more specific to the workflow system at hand.

sub ticket_handle_exception {
    my ($self, $E, $ticket) = @_;
    throw $E;
}


sub ticket_update {
    my ($self, $ticket) = @_;
    try {
        $self->_ticket_update($ticket);
    } catch Error::Hierarchy::Internal::DBI::STH with {
        $self->ticket_handle_exception($_[0], $ticket)
    };
    $ticket;
}


sub ticket_insert {
    my ($self, $ticket) = @_;
    try {
        $self->_ticket_insert($ticket);
    } catch Error::Hierarchy::Internal::DBI::STH with {
        $self->ticket_handle_exception($_[0], $ticket)
    };
    $ticket;
}


1;


__END__

{% USE p = PodGenerated %}

=head1 NAME

{% p.package %} - stage-based conveyor-belt-like ticket handling system

=head1 SYNOPSIS

    {% p.package %}->new;

=head1 DESCRIPTION

None yet. This is an early release; fully functional, but undocumented. The
next release will have more documentation.

=head1 METHODS

=over 4

{% p.write_methods %}

=back

{% p.write_inheritance %}

{% PROCESS standard_pod %}

=cut

